import { Menu, Icon } from 'antd';
import React from 'react';
const SubMenu = Menu.SubMenu;
require('../../css/sideNav.css');

export default class TopNav extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            current: '',
            currentGroup:0
        };
        this.handleNavClick = this.handleNavClick.bind(this)
    }
    componentWillReceiveProps(nextProp){
        this.setState({
            user: nextProp.user,
            current: nextProp.current
        })
    }
    handleNavClick(e) {
        this.setState({
            current: e.key
        },function(){
            this.props._r.push(`/${e.key}`);
            this.props.jump(`${e.key}`);
        });
    }
    render(){
      return (
        <Menu
          key='specialist'
          onClick={this.handleNavClick}
          defaultOpenKeys={[]}
          selectedKeys={[this.state.current]}
          mode="horizontal"
        >
          <Menu.Item key="work-board">
            <Icon type="edit" />工作台
          </Menu.Item>
          <Menu.Item key="subscribe-list">
            <Icon type="bars" />预约列表
          </Menu.Item>
          <Menu.Item key="diagnose-records">
            <Icon type="book" />接诊记录
          </Menu.Item>
            <Menu.Item key="my-product">
                <Icon type="product" />我的产品
            </Menu.Item>
        </Menu>
      )
    }
}